Skip to content

Separate Static and Kinetic Coefficients of Friction #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 18, 2025

Conversation

zfergus
Copy link
Member

@zfergus zfergus commented Jul 17, 2025

Description

This pull request introduces enhancements to tangential collision handling by distinguishing between static and kinetic friction coefficients (mu_s and mu_k) and implementing smooth transitions between them.

Tangential Collision Enhancements:

  • Distinction between static and kinetic friction coefficients: Updated TangentialCollision class to replace mu with separate mu_s (static friction coefficient) and mu_k (kinetic friction coefficient). This change applies to the class definition and all related methods.

  • Updated TangentialCollisions::build method: Modified the method to handle separate mu_s and mu_k coefficients, ensuring that all calculations account for the distinction between static and kinetic friction.

Smooth Friction Coefficient Implementation:

  • New smooth_mu functions: Added functions to compute smooth transitions between static and kinetic friction coefficients, including derivatives and related mathematical formulations. These functions improve the modeling of friction forces at varying tangential velocities.

  • Integration with adhesion module: Incorporated smooth friction coefficient calculations into the adhesion module.

Type of change

  • Enhancement (non-breaking change which improves existing functionality)

How Has This Been Tested?

  • New unit tests for smooth_mu

Checklist

  • I have followed the project style guide
  • My code follows the clang-format style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

zfergus added 6 commits July 15, 2025 09:21
- Added `smooth_mu`, `smooth_mu_derivative`, `smooth_mu_f0`, `smooth_mu_f1`, `smooth_mu_f2`, `smooth_mu_f1_over_x`, and `smooth_mu_f2_x_minus_f1_over_x3` functions in `smooth_mu.cpp` and `smooth_mu.hpp` to handle the transition between static and kinetic friction smoothly.
- Implemented unit tests for the smooth friction functions in `test_smooth_mu.cpp`, including gradient and Hessian checks using finite difference methods.
- Ensured proper assertions and edge case handling for the friction coefficient calculations.
TODO:
* Add separate coeff. in TangentialCollision
* Implement smooth_mu for adhesion
- Introduced smooth friction mollifier functions: smooth_mu_a0, smooth_mu_a1, smooth_mu_a2, smooth_mu_a1_over_x, and smooth_mu_a2_x_minus_mu_a1_over_x3 in adhesion.cpp and adhesion.hpp.
- Updated tangential adhesion potential methods to utilize smooth friction functions instead of direct calculations.
- Refactored existing friction mollifier functions for improved clarity and performance.
- Added unit tests for the new smooth friction mollifier functions to ensure correctness and stability.
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 95.77465% with 6 lines in your changes missing coverage. Please review.

Project coverage is 96.47%. Comparing base (71532a0) to head (7ba8a18).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/ipc/potentials/tangential_adhesion_potential.cpp 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
+ Coverage   96.42%   96.47%   +0.05%     
==========================================
  Files         102      103       +1     
  Lines        7766     7856      +90     
==========================================
+ Hits         7488     7579      +91     
+ Misses        278      277       -1     
Flag Coverage Δ
unittests 96.47% <95.77%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ntation

- Enhance documentation for adhesion and friction modules with new smooth_mu functions.
- Update bindings to include new smooth_mu functionalities.
@zfergus zfergus requested a review from Copilot July 18, 2025 04:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances tangential collision handling by separating static (mu_s) and kinetic (mu_k) friction coefficients and implementing smooth transitions between them using new smooth_mu functions.

  • Replaced single friction coefficient mu with separate mu_s and mu_k throughout the codebase
  • Added new smooth_mu module with functions for smooth friction coefficient transitions
  • Updated potential calculations to handle distinct static/kinetic coefficients with fallback behavior

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ipc/friction/smooth_mu.hpp/.cpp New module implementing smooth static-to-kinetic friction transitions
src/ipc/collisions/tangential/tangential_collision.hpp Updated collision struct to use mu_s and mu_k instead of single mu
src/ipc/potentials/tangential_potential.hpp/.cpp Refactored potential interface to accept separate friction coefficients
src/ipc/potentials/friction_potential.cpp Updated to use new smooth mu functions
tests/src/tests/friction/test_smooth_mu.cpp Comprehensive finite difference tests for new smooth mu functions

@zfergus zfergus added this to the v1.4.0 milestone Jul 18, 2025
@zfergus zfergus added the enhancement New feature or request label Jul 18, 2025
@zfergus zfergus merged commit 245c14d into main Jul 18, 2025
32 checks passed
@zfergus zfergus deleted the separate-friction-coeffs branch July 18, 2025 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant